
#ifndef __C_FILE_SYSTEM_H_INCLUDED__
#define __C_FILE_SYSTEM_H_INCLUDED__

#include "IFileSystem.h"
#include "irrArray.h"

namespace irr
{
    namespace io
    {

        class CZipReader;
        const s32 FILE_SYSTEM_MAX_PATH = 1024;

        /*!
        FileSystem which uses normal files and one zipfile
        */
        class CFileSystem : public IFileSystem
        {
        public:

            //! constructor
            CFileSystem();

            //! destructor
            virtual ~CFileSystem();

            //! opens a file for read access
            virtual IReadFile* createAndOpenFile(const c8* filename);

            //! Opens a file for write access.
            virtual IWriteFile* createAndWriteFile(const c8* filename, bool append=false);

            //! adds an zip archive to the filesystem
            virtual bool addZipFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true);

            //! Returns the string of the current working directory
            virtual const c8* getWorkingDirectory();

            //! Changes the current Working Directory to the string given.
            //! The string is operating system dependent. Under Windows it will look
            //! like this: "drive:\directory\sudirectory\"
            virtual bool changeWorkingDirectoryTo(const c8* newDirectory);

            //! Creates a list of files and directories in the current working directory 
            //! and returns it.
            virtual IFileList* createFileList();

            //! determinates if a file exists and would be able to be opened.
            virtual bool existFile(const c8* filename);

            virtual bool makeDirectory(const c8* newDirectory);

            //! Creates a XML Reader from a file.
            virtual IXMLReader* createXMLReader(const c8* filename);

            //! Creates a XML Reader from a file.
            virtual IXMLReader* createXMLReader(IReadFile* file);

            //! Creates a XML Reader from a file.
            virtual IXMLReaderUTF8* createXMLReaderUTF8(const c8* filename);

            //! Creates a XML Reader from a file.
            virtual IXMLReaderUTF8* createXMLReaderUTF8(IReadFile* file);

            //! Creates a XML Writer from a file.
            virtual IXMLWriter* createXMLWriter(const c8* filename);

            //! Creates a XML Writer from a file.
            virtual IXMLWriter* createXMLWriter(IWriteFile* file);

        private:

            core::array<CZipReader*> ZipFileSystems;
            c8 WorkingDirectory[FILE_SYSTEM_MAX_PATH];
        };



    } // end namespace irr
} // end namespace io

#endif

